package com.bawei.park2211a.car

import androidx.lifecycle.MutableLiveData
import com.bawei.base.bean.AddCarEntity
import com.bawei.base.bean.CarEntity
import com.bawei.base.mvvm.BaseViewModel
import com.bawei.base.net.ApiService
import dagger.hilt.android.lifecycle.HiltViewModel
import javax.inject.Inject

@HiltViewModel
class CarViewModel @Inject constructor(var apiService: ApiService) : BaseViewModel() {
    var carSuccess = MutableLiveData<MutableList<CarEntity>>()
    fun car(id: Int) {
        httpRequest({
            apiService.cart(id)
        }, {
            carSuccess.postValue(it)
        })
    }
    fun addcar(addCarEntity: AddCarEntity){
        httpRequest({apiService.addCar(addCarEntity)},{})
    }
}